<template>
	<view class="page">
		<view class="bar_info" :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx'}">
			<view class="title_bar">
				<view class="title_bar_left" @tap.stop="isBack">
					<u-icon size="38" color="#000" name="arrow-left"></u-icon>
				</view>
				<view class="title_bar_center">
					<text >价值计算</text>
				</view>
				<view class="title_bar_right"></view>
			</view>
		</view>
		<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
		<view class="loading_css" v-if="isShow">
			<u-loading size="36" color="#0E7EFD"></u-loading>
			<view class="loading_text">加载中</view>
		</view>
		
		<view class="calculation_info" v-else>
			<view class="calculation_content">
				<view class="integral_th">
					<view class="integral_th_item">银行</view>
					<view class="integral_th_item">年/交易</view>
					<view class="integral_th_item">手续费</view>
					<view class="integral_th_item">价值</view>
				</view>
				<view class="integral_list">
					<view class="integral_td" v-for="(v, k) in calculationResults" :key="k">
						<view class="integral_td_item">{{v.bank_name}}</view>
						<view class="integral_td_item">{{v.quota}}</view>
						<view class="integral_td_item">{{v.commission}}</view>
						<view class="integral_td_item">{{v.calc_value}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="next_btn" @tap.stop="next">下一步</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				calculationResults: [], // 计算结果
				isShow: true
			}
		},
		onLoad() {
			this.calculationResults = uni.getStorageSync('calculationResults');
			console.log(this.calculationResults);
			this.isShow = false;
		},
		methods: {
			isBack() {
				uni.navigateBack();
			},
			next() {
				uni.navigateTo({
					url: '/pages/index/result'
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		.bar_info {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			// border-bottom: 1px solid #eee;
			// background: #fff;
			z-index: 10;
			position: fixed;
			top: 0rpx;
		
			.title_bar {
				padding: 0 32rpx;
				display: flex;
				justify-content: space-between;
		
				.title_bar_left {
					width: 50rpx;
					display: flex;
					align-items: center;
				}
		
				.title_bar_center {
					line-height: 88rpx;
					font-size: 36rpx;
					font-weight: 400;
				}
		
				.title_bar_right {
					width: 50rpx;
				}
			}
		}
		.calculation_info {
			padding: 30rpx;
			.calculation_content {
				background: #fff;
				border-radius: 4rpx;
				overflow: hidden;
				.integral_th {
					display: flex;
					padding: 20rpx 0;
					background: #EDEFF3;
					.integral_th_item {
						width: 25%;
						font-size: 26rpx;
						text-align: center;
					}
				}
				.integral_list {
					.integral_td {
						display: flex;
						padding: 26rpx 0;
						border-bottom: 1rpx solid #eee;
						.integral_td_item {
							width: 25%;
							text-align: center;
							font-size: 24rpx;
						}
					}
				}
			}
		}
		.next_btn {
			width: 610rpx;
			height: 100rpx;
			background: #0278FC;
			border-radius: 22rpx;
			font-size: 32rpx;
			color: #fff;
			text-align: center;
			line-height: 100rpx;
			position: fixed;
			bottom: 170rpx;
			left: 50%;
			transform: translateX(-50%);
			// margin: 0 auto ;
		}
	}
</style>